package com.hx.skyDrive.biz.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hx.skyDrive.biz.MyFileBiz;
import com.hx.skyDrive.entity.MyFile;
import com.hx.skyDrive.mapper.MyFileMapper;

@Service
public class MyFileBizImpl implements MyFileBiz {
	
	@Autowired
	private MyFileMapper mapper;
	
	@Override
	public int add(MyFile myfile) {
		return mapper.add(myfile);
	}

	@Override
	public List<MyFile> findAll() {
		return mapper.findAll();
	}

	@Override
	public boolean isFileExist(String fName, Long size) {
		Map<String,Object> map = new HashMap<String, Object>();
		map.put("fname", fName);
		map.put("size", size);
		Integer fid = mapper.isFileExist(map);
		if( fid == null )
			return false;
		else if(fid > 0)
			return true;
		return false;
	}

	@Override
	public List<MyFile> finds() {
		return mapper.finds();
	}

	@Override
	public int passFile(String fid) {
		return mapper.passFile(fid);
	}

	@Override
	public int delByFid(String fid) {
		return mapper.delByFid(fid);
	}

	@Override
	public List<MyFile> findByUid(String uid) {
		return mapper.findByUid(uid);
	}

}
